//
//  HD_HSP_Help_ViewController.m
//  HDLiaoNingMeseum
//
//  Created by HDHaoShaoPeng on 2017/8/7.
//  Copyright © 2017年 HDNiuKuiming. All rights reserved.
//

#import "HD_HSP_Help_ViewController.h"
#import "HDDeclare.h"

@interface HD_HSP_Help_ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *myTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *missRode;
@property (weak, nonatomic) IBOutlet UILabel *otherButton;

@property (weak, nonatomic) IBOutlet UILabel *hurtLabel;
@end

static HDDeclare *declare;
@implementation HD_HSP_Help_ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    declare = [HDDeclare sharedDeclare];
    
    self.myTitleLabel.text = declare.sosPage;
    self.myTitleLabel.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:18.0];
    
    self.missRode.text = declare.sosLost;
    self.missRode.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:17.0];
    
    self.hurtLabel.text = declare.sosHurt;
    self.hurtLabel.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:17.0];
    
    self.otherButton.text = declare.sosOther;
    self.otherButton.font = [UIFont fontWithName:@"FZQKBYSJW--GB1-0" size:17.0];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


-(void)sendHelpWith:(NSString *)kind
{
    NSString *requestUrl = [NSString stringWithFormat:@"%@%@",[HDDeclare IP_Request_Header],@"index.php?g=mapi&m=User&a=call_help"];
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:declare.userID,@"device_id",kind,@"type", nil];
    [HD_LY_NetHelper requestWithType:POST withUrl:requestUrl withParams:params toShowVC:self success:^(id response) {
        NSDictionary *dicData = response;
        if ([dicData[@"status"] intValue] == 1)
        {
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:declare.sosSendSuccess message:nil preferredStyle:UIAlertControllerStyleAlert];
            UIAlertAction *action = [UIAlertAction actionWithTitle:declare.alertOK style:UIAlertActionStyleCancel handler:nil];
            [alert addAction:action];
            [self presentViewController:alert animated:YES completion:nil];
            
        }else {
            
        }
    } fail:^(NSError *error) {
        
    } showHUD:NO isCache:YES];
}

#pragma mark - 点击方法

- (IBAction)lostRoad:(id)sender {
    [self sendHelpWith:@"2"];
}

- (IBAction)hurtClicked:(id)sender {
    [self sendHelpWith:@"1"];
}

- (IBAction)othersClicked:(id)sender {
    [self sendHelpWith:@"3"];
}

- (IBAction)backClicked:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


@end



